<template>
  <div class="item" @click="handleDelete(data)" >
    <img :src="data.cover" alt="" />
    <p>{{ data.name }}</p>
  </div>
</template>

<script>
export default {
  props: {
    data: {
      type: Object,
    },
    
  },
  methods: {
    handleDelete(val) {
        // console.log(val);
      var musics = this.$parent.musics;
      console.log(musics); 
      var index = musics.findIndex(item=>item==val)
      console.log(index);
      musics.splice(index,1)
    //   this.$emit('sendMsg',val)
    },
  },
};
</script>

<style scoped>
.item {
  width: 200px;
  border: 1px solid orangered;
}
.item > img {
  width: 200px;
  height: 200px;
}
</style>